#!/usr/bin/env bash
# 安装 Nginx 并启用
set -Eeuo pipefail

type log_info >/dev/null 2>&1 || { echo "[install_nginx] _common.sh 未加载"; exit 1; }

install_nginx_and_enable() {
  ensure_root
  apt_quiet_update
  DEBIAN_FRONTEND=noninteractive apt-get install -y nginx
  systemctl enable --now nginx
  systemctl --no-pager -l status nginx || true
  log_info "Nginx 已安装并启动（开机自启）"
}
